package com.yykj.base.server.converter;

import com.yykj.base.client.dto.template.FormFieldDTO;
import com.yykj.base.server.model.entity.form.template.CommonFormField;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class FormFieldDTOConverter {
    public static FormFieldDTO convert(CommonFormField formField){
        FormFieldDTO dto = new FormFieldDTO();
        BeanUtils.copyProperties(formField,dto);
        return dto;
    }

    public static List<FormFieldDTO> convert(List<CommonFormField> list){
        return list.stream().map(FormFieldDTOConverter::convert).collect(Collectors.toList());
    }
}
